The Mechanism

Lock lock = null;
            boolean lockTimedOut = false;
            try {
                // XXX: Should not hardcode the timeout.
                lock = adminLock.getLock(command, 30, "asadmin");
            ...

            } catch (AdminCommandLockTimeoutException ex) {
                lockTimedOut = true;
                ...
                logger.warning(logMsg);
                report.setMessage(msg);
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            } finally {
                // command is done, release the lock
                if (lock != null && lockTimedOut == false)
                    lock.unlock();
            }

The Message

ouch: ./asadmin list-commands
remote failure: The command was blocked from executing. The domain is
either suspended or another command required exclusive access to the domain.


The domain was suspend or locked on Tue, 14 Sep 2010 11:05:33 PDT.


Command list-commands failed.

Controlling the timeout

  • Currently uses a 30 second default.
  • How should we allow users to control the timeout?
  • Issue 13421

Lock owner

  • Need to record the exclusive lock owner so that it can be provided in error messages.
  • Issue 13423

Freeing some commands of the lock

  • Commands like list-commands probably should not participate in the lock game (e.g. @CommandLock(CommandLock.LockType.NONE))